const init = {
  count: 0
}

export default function countReducer(pervState = init, action) {
  // console.log('count_reducer');

  const {
    type,
    data
  } = action

  switch (type) {
    case 'increase':
      return {
        ...pervState,
        count: pervState.count + data
      };
    case 'decrease':
      return {
        ...init,
        count: pervState.count - data
      };
    default: 
      return pervState
  }
}